<p>To change your password, give both the old and new password.</p>

<?php

require_once 'util.php';
require_once 'actions/save_password.cls.php';
require_once 'actions/edit_profile.cls.php';
require_once 'views/costum/UserSettingsForms.cls.php';

$action = new SavePasswordAction();
$form = $action->get_form_link();
$helper = new UserSettingsForms($form, $view);

echo $form->start();

	echo '<div class="form-layout">';
		
		echo $form->generate(new PasswordComponent(SavePasswordAction::INPUT_OLD_PASSWORD, $view->challenge))->label();
		echo $form->generate(new HiddenField(SavePasswordAction::INPUT_CHALLENGE_ID, $value=$view->challenge_id));
		
		$password = $form->generate(new UnchallengedPasswordComponent(SavePasswordAction::INPUT_PASSWORD));
		echo $password->label('New password');
		$confirm = $form->generate(new ConfirmPasswordField($password));
		echo $confirm->label('Confirm new password');
		
		echo "<div style='clear:both'></div>";
		
	echo '</div>';
		
	echo $form->generate_submit('Change');
	
	$cancel = r(new EditProfileAction())->get_direct_link();
	echo "<a href='{$cancel->__toString()}' class='cancel'>Cancel</a>";
	
echo $form->end();

?>